package edu.scdx.dao;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import edu.scdx.entity.Goods;

@Repository
public interface GoodsMapper {
	
	public List<Goods> getAll();

	@Select("select * from goods where id=#{id}")
	public Goods getGoodById(@Param("id")int id);

	@Select("select * from goods where type=#{type}")
	public List<Goods> getAllWenxue(@Param("type")String wenxue);

	@Select("select * from goods where type=#{type}")
	public List<Goods> getAllSheke(@Param("type")String sheke);

	@Select("select * from goods where type=#{type}")
	public List<Goods> getAllErtong(@Param("type")String ertong);

	@Select("select * from goods where type=#{type}")
	public List<Goods> getAllJiaoxue(@Param("type")String jiaoxue);

	@Select("select * from goods where name like concat(concat('%',#{name}),'%')")
	public List<Goods> getGoodsByName(@Param("name")String name);

	@Select("insert into `goods`(`name`,`author`,`type`,`publisher`,`price`,`description`,`kou`) values(#{name},#{author},#{type},#{publisher},#{price},#{description},#{kou}) ")
	public void addGoods(@Param("name")String name,@Param("author") String author,@Param("type") String type, @Param("publisher")String publisher, @Param("price")Double price, @Param("description")String description,
			@Param("kou")Double kou);

	

}
